import {
    createRouter,
    createWebHashHistory,
    createWebHistory
} from 'vue-router'

import Data from '../views/Data.vue'
import Found from '../views/Found.vue'

import Mine from '../views/mine/Index.vue'
import Set from '../views/mine/Set.vue'
import Login from '../views/mine/Login.vue'
import Reg from '../views/mine/Reg.vue'

import Record from '../views/Record.vue'
import RecordLesson from '../views/record/Lesson.vue'
import RecordNews from '../views/record/News.vue'
import RecordShop from '../views/record/Shop.vue'
 


// 2. 创建路由实例，并配置参数
const router = createRouter({
    // 路由模式
    // 老版本写法：
    // mode:'hash', // 'history'
    history: process.env.NODE_ENV === 'production' ? createWebHistory() : createWebHashHistory(),

    // 配置路由记录
    routes: [
        { path: '', redirect: '/Found' },
        {
            path: '/data',
            component: Data,
            name: 'Data',
        },
        {
            path: '/found',
            component: Found,
            name: 'Found',
        },
        {
            path: '/mine',
            component: Mine,
            name: 'Mine',
        },
        {
            path: '/set',
            component: Set,
            name: 'Set',
        },
        {
            path: '/reg',
            component: Reg,
            name: 'Reg',
        },
        {
            path: '/login',
            component: Login,
            name: 'Login',
        },
        {
            path: '/record',
            component: Record,
            name: 'Record',
            children:[
                {
                    path:'Lesson',
                    component:RecordLesson
                },
                {
                    path:'News',
                    component:RecordNews
                },
                {
                    path:'Shop',
                    component:RecordShop
                }
            ]
        }
    ]
})

export default router